package com.kim.caller.server.service.impl;

import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.kim.caller.server.entity.UserAccount;
import com.kim.caller.server.mapper.UserAccountMapper;
import com.kim.caller.server.service.IUserAccountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kim.caller.server.service.feign.UserInfoFeignService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 用户账户信息表 服务实现类
 * </p>
 *
 * @author KimWu
 * @since 2020-12-29
 */
@Service
public class UserAccountServiceImpl extends ServiceImpl<UserAccountMapper, UserAccount> implements IUserAccountService {

    @Resource
    private UserAccountMapper userAccountMapper;
    @Resource
    private UserInfoFeignService userInfoFeignService;

    @Override
    public void addNoTxlcn() {
        userAccountMapper.insert(build());
        userInfoFeignService.addNoTxlcn();
    }

    @Override
    @LcnTransaction
    public void addTxlcn() {
        userAccountMapper.insert(build());
        userInfoFeignService.addTxlcn();
    }

    private UserAccount build(){
        return new UserAccount(
                null,"txlcnName","txlcnPassWord","12345678901",
                true,true,true,false,null,null
        );
    }
}
